﻿#ifndef ATTRMODEL_H
#define ATTRMODEL_H

#include "DataView_global.h"


namespace xvs {



class DATAVIEW_EXPORT AttrModel : public QAbstractItemModel
{
    Q_OBJECT
public:
    AttrModel();

    void SetAttrObj(AttrObj* attrobj);

    AttrObj* ObjFromIndex(QModelIndex index);

    QModelIndex IndexFromObj(XVObject *obj);

    void Refresh();

public:
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
    QModelIndex index(int row, int column, const QModelIndex &parent) const override;
    QModelIndex parent(const QModelIndex &child) const override;
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
    Qt::ItemFlags flags(const QModelIndex &index) const override;

private:
    AttrObj* mAttrObj;
};





}

#endif // ATTRMODEL_H
